#第一题
s0='abcd'
print(s0.upper())

#第二题
s1=('abcd')
print(s1.find('cd'))

#第三题
s2='a,b,c,d'
b=s2.split()
print(b,type(b))


#第四题
name="张三"
fruit="苹果"
print(f"{name}喜欢{fruit}")
print("{name}喜欢{fruit}".format(name="张三",fruit="苹果"))

#第五题
string="Python is good"
print(string.replace('Python',"python"))
print(string.lower())

#第六题
string="python修炼第一期.html"
print(string.replace('.html',''))
print(string[0:11])
print(string[0:-5])

#第七题
a='123456789'
print(len(a))#用len()函数返回字符串长度

#第8，9，10，11，12，13题
s4="this is a book"
print(s4.replace('book','apple'))

print(s4.startswith('this'))

print(s4.endswith('apple'))

s5="This IS a book"
print(s5.lower())
print(s5.upper())

s6="this is a book\n"
print(r"this is a book\n")
print(s6[0:15])
print(s6.strip())
print(s6.rstrip())

'''
string = "Python is good"
1. string[1:20]  # ython is good
2. string[20] #报错超出范围
3. string[3:-4] # hon is 
4. string[-10:-3] # on is g
5. string.lower() # python is good
6. string.replace("o", "0") # Pyth0n is g00d
7. string.startswith('python') # False
8. string.split() # 'Python','is','good'
9. len(string) # 14
10. string[30] # 报错超出范围
11. string.replace(" ", '') # Pythonisgood
'''
'''
string = "Python is good"
print(string[1:20])
print(string[3:-4])
print(string[-10:-3])
print(string.lower())
print(string.replace("o", "0"))
print(string.startswith('python'))
print(string.split())
print(len(string))
print(string.replace(" ", ''))
'''